package com.dukang.notes.controller

import com.dukang.notes.service.UserServiceImpl
import io.swagger.annotations.Api
import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
import org.springframework.web.bind.annotation.*
import javax.annotation.Resource

@Api(description = "用户信息接口文档")
@RestController
@RequestMapping("/user")
class UserController {

    @Resource
    lateinit var userServiceImpl: UserServiceImpl

    @ApiOperation("添加新用户")
    @PostMapping("/addUser")
    @ResponseBody
    fun addUser(): String {
        return "{\"u_id\":\"10001\"}"
    }

    @ApiOperation("根据用户id获取用户信息")
    @GetMapping("/getUser")
    fun getUserById(@ApiParam("用户id") @RequestParam u_id: String): String {
        val userBean = userServiceImpl.getUserById(u_id)
        return userBean.toString()
    }

}